4.1 Light-emitting diode (LED)

Indeed the class LED is not the Object. It is a base class. Its only destination is to show the light-emitting diode switched on or off on the screen.

Constructors:

LED(
int x0, int y0, // position of the center of LED
char *title, // title of LED
// Hereafter are defaults
int radius = 4, // radius of indicator
int txfont = 0,int txsize = 1,// font style and size of title
LEDcolors color = redLED ); // colors of LED

This constructor must be used when you are declaring the LED indicator. The title is always printed on the right side of indicator. There are three pre-defined colors of LED: redLED, greenLED and yellowLED. In all three color schemes the color of the title is black. But it can be changed by customising colors ( see subsection Colors ).

LED( int radius, LEDcolors color = redLED );

This constructor can be used for special purposes, for example by constructors of derived classes.

Data members:

int on;

Status of LED. Is TRUE ( nonzero ) if LED is lighted on then equal and FALSE ( zero ) if LED is dark.

Methods:

virtual void Paint(void);

Paints LED indicator with title on the right side. Will be LED lighted up or not depends on the value of data member on.

void On(void);
void Off(void);

Switch the indicator on or off. Also sets or resets the data member on.

void Invert(void)

Changes the state of the LED indicator to the opposite.

Color schemes:

Color pattern for LED is provided by the structure

struct LEDcolors { COLORS
title, // color of title
on, // lightened LED color
off; } // dark LED color

There are three pre-defined color patterns for LED: redLED, greenLED and yellowLED. They embrace all existing types of LED indicator and the only color that may be reasonable to customize is the color of the title.